<!-- 本页样式 -->

<style lang="scss" scoped>
.del-dialog-cnt {
  font-size: 16px;
  text-align: center;
}
</style>
<style lang="scss">
.applybatch_list {
  .transform {
    .el-icon-sort {
      transform: rotate(90deg) !important;
    }
  }
}

.applybatch-list-popover {
  // background: rgb(243, 243, 243) !important;
  // border-color: #c6e2ff !important;
  // background-color: #ecf5ff;
  .popper__arrow::after {
    // border-left-color: rgb(243, 243, 243) !important;
    border-left-color: #409eff !important;
    // border-left-color: #c6e2ff !important;
    // background-color: #ecf5ff;
  }
}

.delconfirm {
  border: solid 1px #db2828;
  line-height: 30px;
  border-radius: 2px;
  background-color: #ffe8e6;
  color: #db2828;
  margin: 1em 0em;
  padding: 5px 10px;
}

.delconfirminput {
  .el-input__inner {
    background: #fff0f0;
    border-color: #dbb1b1;
    color: #d95c5c;
    border-radius: 2px;
  }
}

.deldialog {
  .el-dialog__body {
    padding: 0px 20px 10px;
  }
}
</style>
<!-- 页面布局-->
<template>
  <div class="table applybatch_list">
    <!-- 标题导航栏 -->
    <div class="title-box crumbs">
      <el-breadcrumb separator="/">
        <el-breadcrumb-item>
          <i class="el-icon-tickets"></i>资源管理
        </el-breadcrumb-item>
        <el-breadcrumb-item>文件记录</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <!-- 主体区 -->
    <div class="container">
      <!-- 查询条件 -->
      <div class="search-box">
        <div class="search-item-box">
          <table>
            <tr>
              <td>
                <i class="el-icon-search"></i>
              </td>
              <!-- <td class="search_td" style="width:190px;">
                            <el-input v-model="parampters.operateId" placeholder="业务id" clearable class="handle-input mr10" style="width:190px;"></el-input>
                        </td> -->
              <td class="search_td" style="width: 190px">
                <el-input
                  v-model="parampters.fileName"
                  placeholder="文件名称"
                  clearable
                  class="handle-input mr10"
                  style="width: 190px"
                ></el-input>
              </td>
              <td class="search_td" style="width: 190px">
                <el-select
                  clearable
                  class="handle-input mr10"
                  style="width: 190px"
                  v-model="parampters.status"
                  placeholder="状态"
                >
                  <el-option
                    v-for="item in dicts.dictionary"
                    :key="item.code"
                    :label="item.name"
                    :value="item.code"
                  ></el-option>
                </el-select>
              </td>
              <td class="search_td" style="width: 190px">
                <el-select
                  clearable
                  class="handle-input mr10"
                  style="width: 190px"
                  v-model="parampters.fileType"
                  placeholder="文件类型"
                >
                  <el-option
                    v-for="item in operateFileTypeList"
                    :key="item.fileType"
                    :label="item.fileTypeName"
                    :value="item.fileType"
                  ></el-option>
                </el-select>
              </td>
            </tr>
          </table>
        </div>
        <div class="search-button-box">
          <el-button
            type="primary"
            size="small"
            icon="search"
            @click="searchLoad"
            >查询</el-button
          >
        </div>
      </div>
      <!-- 查询条件END -->
      <!-- 数据列表 -->
      <div class="grid-data-box" :style="autoHeight">
        <el-table
          stripe
          :data="tableData"
          border
          :cell-class-name="changeColumnClass"
          :header-cell-style="{ background: '#F3F3F3', color: '#606266' }"
          show-overflow-tooltip
          style="width: 100%"
          ref="multipleTable"
        >
          <el-table-column
            type="index"
            label="序号"
            width="50"
            show-overflow-tooltip
          ></el-table-column>
          <template v-for="(column, i) in columnData">
            <el-table-column
              :prop="column.columnCode"
              :key="i"
              sortable
              width="700"
              v-if="column.columnCode == 'fileName'"
              :label="column.columnName"
              show-overflow-tooltip
            >
              <template slot-scope="scope">
                <div
                  class="fxrow fxcc"
                  style="display: flex; justify-content: space-between"
                >
                  <el-popover placement="right" width="330" trigger="hover">
                    <span>{{ scope.row.fileName }}</span>
                    <span
                      slot="reference"
                      style=""
                      >{{ scope.row.fileName }}</span
                    >
                  </el-popover>
                  <a :href="scope.row.fileUrl" :download="scope.row.fileName">
                    <i
                      class="el-icon-download"
                      style="cursor: pointer; font-size: 14px"
                    ></i>
                  </a>
                </div>
              </template>
            </el-table-column>
            <el-table-column
              :prop="column.columnCode"
              :key="i"
              sortable
              :width="
                column.columnCode == 'updateTime' ||
                column.columnCode == 'applyBatchNo'
                  ? '150'
                  : 'auto'
              "
              v-else-if="
                (column.columnCode !== 'fileName' && column.visiable == '1') ||
                column.visiable == 1
              "
              :label="column.columnName"
              show-overflow-tooltip
            >
            </el-table-column>
          </template>
        </el-table>
      </div>
      <!-- 数据列表END -->
      <!-- 翻页导航条 -->
      <div class="navigate-box">
        <div class="pagination">
          <el-pagination
            background
            @current-change="handleCurrentChange"
            :total="parampters.totalCount"
            @size-change="handleSizeChange"
            :current-page.sync="parampters.pageIndex"
            :page-sizes="[20, 50, 100, 200]"
            :page-size="parampters.pageRows"
            layout="total, sizes, prev, pager, next"
          >
          </el-pagination>
        </div>
      </div>
      <!-- 翻页导航条END -->
    </div>
    <!-- 主体区END -->
  </div>
</template>

<script>
export default {
  data() {
    return {
      autoHeight: {
        minHeight: this.$util.setTableHeight() + "px",
      },
      // 筛选条件
      parampters: {
        //查询参数
        operateId: "", //业务id
        fileName: "", //申请批次
        status: "", //状态
        fileType: "",
        pageRows: 20, //每页行数
        pageIndex: 1, //当前页
        totalCount: 0, //总记录数
      },
      // 查询出的表格数据
      tableLoading: true,
      columnData: [], //表头
      tableData: [],
      operateFileTypeList: [],
      //confirm提示信息弹框
      confirmBox: null,
      //所选记录id
      selectedId: "",
      //事物类型
      actType: "list",
      //字典集
      dicts: {},
      dialogVisible: false,
      dialog_time: 5,
      dialogTimer: null,
      delDialogVisible: false,
      delApplyBatchNo: "",
      confirmDelApplyBatchNo: "",
      showDeltips: false,
      allStatusButton: [],
      allRightButton: [
        {
          id: 1,
          tag: "cardApplyBatch_button_commit",
          name: "提交",
          method: "toReApply",
          type: "primary",
        },
        {
          id: 2,
          tag: "cardApplyBatch_button_update",
          name: "修改",
          method: "toUpd",
          type: "primary",
        },
        {
          id: 3,
          tag: "cardApplyBatch_button_exportDetail",
          name: "导出明细 Excel",
          method: "toExportExcel",
          type: "primary",
        },
        {
          id: 4,
          tag: "cardApplyBatch_button_getFiles",
          name: "可下载文件列表",
          method: "toDownloadFileList",
          type: "primary",
        },
        {
          id: 5,
          tag: "cardApplyBatch_button_getLogs",
          name: "申请日志列表",
          method: "toApplyRecord",
          type: "primary",
        },
        {
          id: 6,
          tag: "cardApplyBatch_button_divide",
          name: "制卡数据转换",
          method: "transformFile",
          type: "primary",
        },
        {
          id: 7,
          tag: "cardApplyBatch_button_delete",
          name: "作废",
          method: "preDel",
          type: "danger",
        },
        {
          id: 8,
          tag: "cardApplyBatch_button_doDelete",
          name: "作废申请处理",
          method: "toDelDeal",
          type: "primary",
        },
      ],
      rightButton: [
        {
          id: 3,
          tag: "cardApplyBatch_button_exportDetail",
          name: "查看MCA明细",
          method: "toMcaDetail",
          type: "primary",
        },
        {
          id: 4,
          tag: "cardApplyBatch_button_exportDetail",
          name: "导入手机号明细",
          method: "toimportMobile",
          type: "primary",
        },
        // TODO:待开发重试制卡文件和导入海航相关
        // {
        //     id: 4,
        //     tag: "cardApplyBatch_button_exportDetail",
        //     name: "重试导入制卡文件",
        //     method: "toRetryImport",
        //     type: "primary"
        // },
        // {
        //     id: 4,
        //     tag: "cardApplyBatch_button_exportDetail",
        //     name: "导入海航数据文件",
        //     method: "toImportHaihang",
        //     type: "primary"
        // },
        // {
        //     id: 4,
        //     tag: "cardApplyBatch_button_exportDetail",
        //     name: "重试导入海航数据文件",
        //     method: "toRetryImportHaihang",
        //     type: "primary"
        // },
      ],
      ispList: [],
    };
  },
  computed: {
    disableDelBtn: function () {
      if (
        this.confirmDelApplyBatchNo == "" ||
        this.confirmDelApplyBatchNo == undefined ||
        this.confirmDelApplyBatchNo == null
      )
        return true;
      else return false;
    },
  },
  // 进入页面加载数据
  activated() {
    this.$set(this.parampters, "operateId", "");
    this.$set(this.parampters, "fileName", "");
    this.$set(this.parampters, "status", "");
    this.$set(this.parampters, "fileType", "");
    this.loadOperateFileType();
    this.handleInitLoad();
  },
  methods: {
    /**
     * 组件初始化加载
     */
    handleInitLoad() {
      this.initSelectOptoins();
      // this.getStatusAllButton();
      this.loadColumnData();
      this.searchLoad();
    },

    /**
     * 初始加载字典选项
     */
    initSelectOptoins() {
      this.loadSelectOptoins("dictionary", { type: "cardapply" });
      // this.loadSelectOptoins("cardapply", null);
      // this.loadSelectOptoins("dataformatNo", null);
    },

    /**
     * 通用定义:下拉字典
     *  @augments dictKind 字典类型
     */
    loadSelectOptoins(dictKind, params) {
      let url = "/herp/dictionary/";
      this.$axios
        .get(url, {
          params: params,
          headers: {
            operator: this.$util.getLoginer().userid,
            withCredentials: true,
          },
        })
        .then((res) => {
          let data = res.data;
          if (data.success) {
            this.$set(this.dicts, dictKind, data.data.list);
          } else {
            this.$error(data.message);
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },

    changeColumnClass(data) {
      if (data.column.property == "updateTime") {
        data.column.width = 150;
      }
      // if (data.columnIndex == 1 || data.columnIndex == 2) {
      //   return "tabcolumn_left";
      // }
    },

    /**
     * @augments  row 行所在的数据
     * 表格数据列 内容字典转换
     */
    formatter(row, column) {
      if (column.property == "dataformatNo") {
        return this.$dicts.transDict(
          this.dicts.dataformatNo,
          "code",
          "name",
          row.dataformatNo
        );
      } else if (column.property == "status") {
        return this.$dicts.transDict(
          this.dicts.cardapply,
          "code",
          "name",
          row.status
        );
      } else if (column.property == "timestamp") {
        if (
          row.timestamp == undefined ||
          row.timestamp == null ||
          row.timestamp == ""
        ) {
          return "";
        } else {
          let now = new Date(Number(row.timestamp));
          let y = now.getFullYear();
          let m = now.getMonth() + 1;
          let d = now.getDate();
          return (
            y +
            "-" +
            (m < 10 ? "0" + m : m) +
            "-" +
            (d < 10 ? "0" + d : d) +
            " " +
            now.toTimeString().substr(0, 8)
          );
        }
      }
    },

    /**
     * @augments val 页码
     * 切换页码操作
     */
    handleCurrentChange(val) {
      this.parampters.pageIndex = val;
      // 重新获取当前页码的数据
      this.searchLoad();
    },

    /**
     * @augments val 每页显示条数
     * 每页显示条数修改
     */
    handleSizeChange(val) {
      // 修改每页显示条数
      this.parampters.pageRows = val;
      // 重新获取数据
      this.searchLoad();
    },
    /**
     * 获取所有状态值的可操作按钮列表
     */
    getStatusAllButton() {
      this.$axios
        .get("/herp/cardApplyBatch/button/?" + new Date().getTime(), {
          headers: {
            operator: this.$util.getLoginer().userid,
            withCredentials: true,
          },
        })
        .then((res) => {
          let data = res.data;
          if (data.success) {
            this.allStatusButton = data.data;
          } else {
            this.$error(data.message);
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },

    /**
     * 条件筛选查询,加载数据
     */
    searchLoad() {
      this.parampters = this.$util.trimObjStr(this.parampters);
      this.tableLoading = true;
      this.$axios
        .get("/herp/operateFile/", {
          params: this.parampters,
          headers: {
            operator: this.$util.getLoginer().userid,
            withCredentials: true,
          },
        })
        .then((res) => {
          let data = res.data;
          if (data.success) {
            this.tableData = data.data.list;
            this.tableLoading = false;
            this.parampters.pageIndex =
              data.data.pageNum != undefined ? parseInt(data.data.pageNum) : 0;
            this.parampters.pageRows =
              data.data.pageSize != undefined
                ? parseInt(data.data.pageSize)
                : 0;
            this.parampters.totalCount =
              data.data.count != undefined ? parseInt(data.data.count) : 0;
          } else {
            this.tableLoading = false;
            this.$error(data.message);
          }
        })
        .catch((err) => {
          this.tableLoading = false;
          console.log(err);
        });
    },

    /**
     * 获取右侧可点击按钮
     */
    getRightButton(row) {
      // let rightbtn = this.allStatusButton[row.status];
      // this.rightButton = this.allStatusButton;
      // console.log(this.rightButton)
      // this.allRightButton.forEach(button => {
      //   rightbtn.forEach(item => {
      //     if (button.tag == item.tag) {
      //       this.rightButton.push(button);
      //     }
      //   });
      // });
    },

    /**
     * 点击右侧按钮
     */
    handleClickMore(row, method) {
      this[method](row);
    },

    /**
     * 校验当前是否有未通过的制卡申请单
     */
    preApply(flag) {
      // this.$axios
      //   .get("/herp/cardApplyBatchs/unConfirmed/", {
      //     headers: {
      //       operator: this.$util.getLoginer().userid,
      //       withCredentials: true
      //     }
      //   })
      //   .then(res => {
      //     let data = res.data;
      //     if (data.success) {
      switch (flag) {
        case "file":
          this.toFileApply();
          return;
        case "batch":
          this.toBatchApply();
          return;
        case "white":
          this.toApply();
          return;
        case "mca":
          this.toMca();
          return;
      }
      //   } else {
      //     this.$error(data.message);
      //   }
      // })
      // .catch(err => {
      //   console.log(err);
      // });
    },

    /**
     * 制卡文件导入
     */
    toFileApply() {
      //页面参数
      var pageParam = {
        loginInfo: this.$util.getLoginer(),
        actType: "add",
        seleid: "-1",
      };
      let commDialog = this.$dialog.commDialog(
        "制卡文件导入",
        fileapply,
        pageParam,
        this.$util.setDialogWidth(),
        this.$util.setDialogHeight()
      );
      commDialog.exec.then((data) => {
        if(data.type == 'ok')
        this.searchLoad();
      });
    },
    /**
     * mca导入
     */
    toMca() {
      //页面参数
      var pageParam = {
        loginInfo: this.$util.getLoginer(),
        actType: "add",
        seleid: "-1",
      };
      let commDialog = this.$dialog.commDialog(
        "MCA文件导入",
        mcaupload,
        pageParam,
        this.$util.setDialogWidth(),
        this.$util.setDialogHeight()
      );
      commDialog.exec.then((data) => {
        if(data.type == 'ok')
        this.searchLoad();
      });
    },

    /**
     * 成卡申请
     */
    toBatchApply() {
      //页面参数
      var pageParam = {
        loginInfo: this.$util.getLoginer(),
        actType: "add",
      };
      let commDialog = this.$dialog.commDialog(
        "按号段录入申请",
        batchapply,
        pageParam,
        this.$util.setDialogWidth(),
        this.$util.setDialogHeight()
      );
      commDialog.exec.then((data) => {
        if(data.type == 'ok')
        this.searchLoad();
      });
    },

    /**
     * 白卡申请
     */
    toApply() {
      //页面参数
      var pageParam = {
        loginInfo: this.$util.getLoginer(),
        actType: "add",
        seleid: "-1",
      };
      let commDialog = this.$dialog.commDialog(
        "联通白卡申请",
        apply,
        pageParam,
        this.$util.setDialogWidth(),
        this.$util.setDialogHeight()
      );
      commDialog.exec.then((data) => {
        if(data.type == 'ok')
        this.searchLoad();
      });
    },

    /**
     * 重新申请
     */
    toReApply(row) {
      this.confirmBox = this.$dialog.confirm("确定要提交所选制卡申请记录吗？");
      this.confirmBox.exec.then((btnName) => {
        if (btnName == "ok") {
          this.$util.loadingshow();
          let url = "/herp/cardApplyBatch/" + row.cardApplyBatchId + "/";
          this.$axios
            .post(url, {})
            .then((res) => {
              this.$util.loadinghide();
              let data = res.data;
              if (data.success) {
                this.$dialog.close(this.confirmBox.vm);
                this.dialogVisible = true;
                this.dialog_time = 5;
                this.dialogTimer = setInterval(() => {
                  this.dialog_time--;
                  if (this.dialog_time == 0) {
                    clearInterval(this.dialogTimer);
                    this.dialogVisible = false;
                    this.searchLoad();
                  }
                }, 1000);
              } else {
                this.$dialog.close(this.confirmBox.vm);
                this.$error(data.message);
              }
            })
            .catch((err) => {
              this.$dialog.close(this.confirmBox.vm);
              this.$util.loadinghide();
              console.log(err);
            });
        } else {
          this.$dialog.close(this.confirmBox.vm);
        }
      });
    },

    /**
     * 修改记录信息
     * @augments index 编辑数据所在的行索引
     * @augments row 编辑数据行的数据
     */
    toUpd(row) {
      if (row.dataformatNo == "01") {
        this.$error("白卡申请不支持修改");
        return;
      }
      this.selectedId = row.cardApplyBatchId;
      //页面参数
      var pageParam = {
        actType: "upd",
        seleid: this.selectedId,
      };
      let commDialog = this.$dialog.commDialog(
        "编辑联通制卡申请信息",
        applybatchupd,
        pageParam,
        this.$util.setDialogWidth(),
        this.$util.setDialogHeight()
      );
      commDialog.exec.then((resp) => {
        if (resp.type == "ok") {
          this.searchLoad();
        } else if (resp.type == "cancel") {
        }
      });
    },

    /**
     * 导出 excel
     */
    toExportExcel(row) {
      let cardApplyBatchId = row.cardApplyBatchId;
      this.$axios
        .get("/herp/cardApplyDetail/" + cardApplyBatchId + "/export/", {
          headers: {
            operator: this.$util.getLoginer().userid,
            withCredentials: true,
          },
        })
        .then((res) => {
          let data = res.data;
          // 关闭提交表单的loading
          if (data.success) {
            let downloadUrl = data.data;
            let n = downloadUrl.split("/");
            var link = document.createElement("a");
            //设置下载的文件名
            link.download = n[n.length - 1];
            link.style.display = "none";
            //设置下载路径
            link.href = downloadUrl;
            //浏览器兼容，禁止打开新的页面
            link.target = "_self";
            //触发点击
            document.body.appendChild(link);
            link.click();
            //移除节点
            document.body.removeChild(link);
          } else {
            this.$error(data.message);
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },

    //
    clickToView(rowData, column, event) {
      this.toView(rowData);
    },

    /**
     * 查看记录信息
     * @augments row 编辑数据行的数据
     * @augments ev
     */
    toView(row) {
      this.selectedId = row.cardApplyBatchId;
      if (row.dataformatNo == "02") {
        //页面参数
        let pageParam = {
          actType: "view",
          seleid: this.selectedId,
        };
        let commDialog = this.$dialog.commDialog(
          "查看联通制卡申请信息",
          applybatchupd,
          pageParam,
          this.$util.setDialogWidth(),
          this.$util.setDialogHeight()
        );
        commDialog.exec.then((data) => {});
      } else {
        //页面参数
        let pageParam = {
          actType: "view",
          seleid: this.selectedId,
        };
        let commDialog = this.$dialog.commDialog(
          "查看联通制卡申请信息",
          apply,
          pageParam,
          this.$util.setDialogWidth(),
          this.$util.setDialogHeight()
        );
        commDialog.exec.then((data) => {});
      }
    },

    preDel(row) {
      this.selectedId = row.cardApplyBatchId;
      this.delApplyBatchNo = row.applyBatchNo;
      this.delDialogVisible = true;
      this.confirmDelApplyBatchNo = "";
    },

    /**
     * 删除记录信息
     * @augments index 所在表格行的索引
     * @augments row 所在表格行的所有数据对象
     */
    toDel() {
      if (this.confirmDelApplyBatchNo.trim() != this.delApplyBatchNo) {
        this.showDeltips = true;
        return;
      } else {
        this.showDeltips = false;
      }
      this.$axios
        .delete(
          "/herp/cardApplyBatch/" + this.selectedId + "/",
          {
            loginsid: this.$util.getLoginer().sessionId,
            userid: this.selectedId,
          },
          {
            headers: {
              operator: this.$util.getLoginer().userid,
              withCredentials: true,
            },
          }
        )
        .then((res) => {
          let data = res.data;
          if (data.success) {
            let url = data.data;
            if (url != null && url != undefined && url != "") {
              this.$alert(
                "需要到联通方继续申请作废，点击确定后将于新页面打开联通方网站",
                "",
                {
                  confirmButtonText: "去往联通",
                  closeOnClickModal: false,
                  showClose: false,
                }
              ).then(
                (confirm) => {
                  this.delDialogVisible = false;
                  this.searchLoad();
                  let n = url.split("/");
                  var link = document.createElement("a");
                  link.style.display = "none";
                  //设置下载路径
                  link.href = url;
                  //浏览器兼容，禁止打开新的页面
                  link.target = "_blank";
                  //触发点击
                  document.body.appendChild(link);
                  link.click();
                  //移除节点
                  document.body.removeChild(link);
                },
                (cancel) => {
                  this.delDialogVisible = false;
                  console.log(cancel);
                }
              );
            } else {
              this.$message.success("作废申请已提交");
              this.delDialogVisible = false;
              this.searchLoad();
            }
          } else {
            this.$error(data.message);
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },

    transformFile(row) {
      this.selectedId = row.cardApplyBatchId;
      //页面参数
      var pageParam = {
        seleid: this.selectedId,
      };
      let commDialog = this.$dialog.commDialog(
        "制卡数据转换",
        formatfile,
        pageParam,
        this.$util.setDialogWidth(),
        this.$util.setDialogHeight()
      );
      commDialog.exec.then((resp) => {
        if (resp.type == "ok") {
        } else if (resp.type == "cancel") {
        }
      });
    },

    ifDel(status) {
      status = Number(status);
      if (
        status != 1 &&
        status != 2 &&
        status != 4 &&
        status != 6 &&
        status != 9
      ) {
        return true;
      } else {
        return false;
      }
    },

    /**
     * 立即下载并解析
     */
    download2analysNow() {
      this.$axios
        .post("/herp/downloadScheduleFiles/?" + new Date(), {})
        .then((res) => {
          this.$message.success(
            "请求成功，将于后台服务器自动下载所有文件并解析"
          );
        })
        .catch((err) => {
          console.log(err);
        });
    },

    /**
     * 作废申请处理
     */
    toDelDeal(row) {
      this.selectedId = row.cardApplyBatchId;
      //页面参数
      var pageParam = {
        seleid: this.selectedId,
        delApplyBatchNo: row.applyBatchNo,
      };
      let commDialog = this.$dialog.commDialog(
        "作废申请处理",
        deldeal,
        pageParam,
        this.$util.setDialogWidth(),
        this.$util.setDialogHeight()
      );
      commDialog.exec.then((resp) => {
        if (resp.type == "ok") {
          this.searchLoad();
        } else if (resp.type == "cancel") {
        }
      });
    },

    /**
     * 可下载文件列表
     */
    toDownloadFileList(row) {
      this.selectedId = row.cardApplyBatchId;
      //页面参数
      var pageParam = {
        seleid: this.selectedId,
      };
      let commDialog = this.$dialog.commDialog(
        "查看可下载文件列表",
        downloadfilelist,
        pageParam,
        this.$util.setDialogWidth(),
        this.$util.setDialogHeight()
      );
      commDialog.exec.then((resp) => {
        if (resp.type == "ok") {
        } else if (resp.type == "cancel") {
        }
      });
    },

    /**
     * 查看申请操作日志
     */
    toApplyRecord(row) {
      this.selectedId = row.applyBatchNo;
      //页面参数
      var pageParam = {
        seleid: this.selectedId,
      };
      let commDialog = this.$dialog.commDialog(
        "查看申请操作日志",
        applyrecord,
        pageParam,
        this.$util.setDialogWidth(),
        this.$util.setDialogHeight()
      );
      commDialog.exec.then((resp) => {
        if (resp.type == "ok") {
        } else if (resp.type == "cancel") {
        }
      });
    },
    //导出
    toExportApplyBatch() {
      this.$axios
        .get("/herp/cardApplyBatch/export/", {
          params: this.parampters,
          headers: {
            operator: this.$util.getLoginer().userid,
            withCredentials: true,
          },
        })
        .then((res) => {
          let data = res.data;
          // 关闭提交表单的loading
          if (data.success) {
            let downloadUrl = data.data;
            let n = downloadUrl.split("/");
            var link = document.createElement("a");
            //设置下载的文件名
            link.download = n[n.length - 1];
            link.style.display = "none";
            //设置下载路径
            link.href = downloadUrl;
            //浏览器兼容，禁止打开新的页面
            link.target = "_self";
            //触发点击
            document.body.appendChild(link);
            link.click();
            //移除节点
            document.body.removeChild(link);
          } else {
            this.$error(data.message);
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
    //加载基础运营商编码
    loadOperateFileType() {
      this.$axios
        .get("/herp/operateFileType/", {
          headers: {
            operator: this.$util.getLoginer().userid,
            withCredentials: true,
          },
        })
        .then((res) => {
          let data = res.data;
          // 关闭提交表单的loading
          if (data.success) {
            this.operateFileTypeList = data.data;
            console.log(this.operateFileType);
          } else {
            this.$error(data.message);
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
    //mca详情
    toMcaDetail(row) {
      //页面参数
      var pageParam = {
        cardApplyBatchId: row.cardApplyBatchId,
        actType: "upd",
        applyBatchNo: row.applyBatchNo,
      };
      let commDialog = this.$dialog.commDialog(
        "查看手机号明细",
        applybatchupd,
        pageParam,
        this.$util.setDialogWidth(),
        this.$util.setDialogHeight()
      );
      commDialog.exec.then((resp) => {
        if (resp.type == "ok") {
        } else if (resp.type == "cancel") {
        }
      });
    },
    /**
     * 加载资源管理表格的表头
     */
    loadColumnData(item) {
      this.$axios
        .get(`/herp/table/operateFilePage/column/`, {
          headers: {
            operator: this.$util.getLoginer().userid,
            withCredentials: true,
          },
        })
        .then((res) => {
          let data = res.data;
          // 关闭提交表单的loading
          if (data.success) {
            this.columnData = data.data;
          } else {
            this.$error(data.message);
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
  },
};
</script>
